/**
 * 
 * Beim Anlegen eines neuen AlarmManagers wird dieser BroadcastReceiver angegeben, welcher wiederum die AlarmActivity startet
 * 
 */

package com.example.RemindMe;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

public class AlarmReceiver extends BroadcastReceiver {
	@Override
	public void onReceive(Context context, Intent in) {

		AlarmAlertWakeLock.acquireCpuWakeLock(context);

		int id;

		Intent alarm = new Intent(context, AlarmActivity.class);

		if (in.getExtras().get("id") != null) {
			id = (Integer) in.getExtras().get("id");

		} else {
			id = 0;
		}

		alarm.putExtra("id", id);

		alarm.addFlags(Intent.FLAG_FROM_BACKGROUND);
		alarm.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
		context.startActivity(alarm);

	}
}